package com.mtf.transation.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author matengfei
 * @Date 2024/6/29 11:31
 * @PackageName:com.mtf.transation.service.impl
 * @ClassName: PropagationServiceImpl
 * @Description: TODO
 * @Version 1.0
 */
@Service
public class PropagationServiceImpl {

    @Transactional
    public void required() {
        throw new NullPointerException("假装抛出了异常");
    }

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void requiresNew() {
        throw new NullPointerException("假装抛出了异常");
    }
}
